package com.schoolinfo.model;
// default package

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * FirstClass entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="firstclass"
)

public class FirstClass  implements java.io.Serializable {


    // Fields    

     private Integer id;
     private String name;
     private Set<SecondClass> secondClasses = new HashSet<SecondClass>(0);


    // Constructors

    /** default constructor */
    public FirstClass() {
    }

	/** minimal constructor */
    public FirstClass(String name) {
        this.name = name;
    }
    
    /** full constructor */
    public FirstClass(String name, Set<SecondClass> secondClasses) {
        this.name = name;
        this.secondClasses = secondClasses;
    }

   
    // Property accessors
    @Id @GeneratedValue
    
    @Column(name="id", unique=true, nullable=false)

    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
    
    @Column(name="name", nullable=false, length=50)

    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER,mappedBy="firstId")

    public Set<SecondClass> getSecondClasses() {
        return this.secondClasses;
    }
    
    public void setSecondClasses(Set<SecondClass> secondClasses) {
        this.secondClasses = secondClasses;
    }
   








}